/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1698680346576_7184';

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
    mysql: {
      client: {
        // host
        // host: '43.142.185.98',
        host: '127.0.0.1',
        // 端口号
        port: '3306',
        // 用户名
        user: 'root',
        // 密码
        password: '123456',
        // 数据库名
        database: 'back',
      },
      //  mysql对象挂在到app对象上
      app: true,
      agent: false,
    },
    //  关闭csrf漏洞检测
    security: {
      csrf: {
        enable: false
      }

    },
    jwt: {
      // 秘钥
      secret: "liaoliulongisme"
    },
    cors: {
      origin: '*', // 允许哪个地址跨域请求  用 * 是允许所有跨域
      allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH', // 允许哪些方法跨域请求
      credentials: true, // 允许前端携带cookie
    }
  };

  return {
    ...config,
    ...userConfig,
  };
};
